# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=sphinx-copybutton
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-$_realname")
pkgver=0.5.2
pkgrel=2
pkgdesc="Sphinx extension to add a \"copy\" button to code blocks (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://sphinx-copybutton.readthedocs.io/"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-sphinx")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=(https://files.pythonhosted.org/packages/source/s/$_realname/$_realname-$pkgver.tar.gz)
sha256sums=('4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd')

prepare() {
  cd "${srcdir}"
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  "${MINGW_PREFIX}"/bin/python setup.py install -O1 --skip-build \
      --root="${pkgdir}" --prefix="${MINGW_PREFIX}"

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
  install -Dm644 README.md "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/README.md"
}

# vim:set ts=2 sw=2 et:
